0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 1 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 0 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 58 ms)
↳10 BOUNDS(1, 1)
f(0) → cons(0)
f(s(0)) → f(p(s(0)))
p(s(X)) → X
f(0) → cons(0) [1]
f(s(0)) → f(p(s(0))) [1]
p(s(X)) → X [1]
f(0) → cons(0) [1]
f(s(0)) → f(p(s(0))) [1]
p(s(X)) → X [1]
f :: 0:s → cons 0 :: 0:s cons :: 0:s → cons s :: 0:s → 0:s p :: 0:s → 0:s |
f(v0) → null_f [0]
p(v0) → null_p [0]
null_f, null_p
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
0 => 0
null_f => 0
null_p => 0
f(z) -{ 1 }→ f(p(1 + 0)) :|: z = 1 + 0
f(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0
f(z) -{ 1 }→ 1 + 0 :|: z = 0
p(z) -{ 1 }→ X :|: z = 1 + X, X >= 0
p(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0
eq(start(V),0,[f(V, Out)],[V >= 0]). eq(start(V),0,[p(V, Out)],[V >= 0]). eq(f(V, Out),1,[],[Out = 1,V = 0]). eq(f(V, Out),1,[p(1 + 0, Ret0),f(Ret0, Ret)],[Out = Ret,V = 1]). eq(p(V, Out),1,[],[Out = X1,V = 1 + X1,X1 >= 0]). eq(f(V, Out),0,[],[Out = 0,V1 >= 0,V = V1]). eq(p(V, Out),0,[],[Out = 0,V2 >= 0,V = V2]). input_output_vars(f(V,Out),[V],[Out]). input_output_vars(p(V,Out),[V],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. non_recursive : [p/2]
1. recursive : [f/2]
2. non_recursive : [start/1]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into p/2
1. SCC is partially evaluated into f/2
2. SCC is partially evaluated into start/1
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations p/2
* CE 7 is refined into CE [9]
* CE 8 is refined into CE [10]
### Cost equations --> "Loop" of p/2
* CEs [9] --> Loop 7
* CEs [10] --> Loop 8
### Ranking functions of CR p(V,Out)
#### Partial ranking functions of CR p(V,Out)
### Specialization of cost equations f/2
* CE 6 is refined into CE [11]
* CE 4 is refined into CE [12]
* CE 5 is refined into CE [13,14]
### Cost equations --> "Loop" of f/2
* CEs [13,14] --> Loop 9
* CEs [11] --> Loop 10
* CEs [12] --> Loop 11
### Ranking functions of CR f(V,Out)
#### Partial ranking functions of CR f(V,Out)
### Specialization of cost equations start/1
* CE 2 is refined into CE [15,16,17]
* CE 3 is refined into CE [18,19]
### Cost equations --> "Loop" of start/1
* CEs [17] --> Loop 12
* CEs [15,16,18,19] --> Loop 13
### Ranking functions of CR start(V)
#### Partial ranking functions of CR start(V)
Computing Bounds
=====================================
#### Cost of chains of p(V,Out):
* Chain [8]: 0
with precondition: [Out=0,V>=0]
* Chain [7]: 1
with precondition: [V=Out+1,V>=1]
#### Cost of chains of f(V,Out):
* Chain [11]: 1
with precondition: [V=0,Out=1]
* Chain [10]: 0
with precondition: [Out=0,V>=0]
* Chain [9,11]: 3
with precondition: [V=1,Out=1]
* Chain [9,10]: 2
with precondition: [V=1,Out=0]
#### Cost of chains of start(V):
* Chain [13]: 2
with precondition: [V>=0]
* Chain [12]: 3
with precondition: [V=1]
Closed-form bounds of start(V):
-------------------------------------
* Chain [13] with precondition: [V>=0]
- Upper bound: 2
- Complexity: constant
* Chain [12] with precondition: [V=1]
- Upper bound: 3
- Complexity: constant
### Maximum cost of start(V): 3
Asymptotic class: constant
* Total analysis performed in 43 ms.